//
//  UserModelArchive.m
//  DriftDog
//
//  Created by rimi on 15/9/13.
//  Copyright (c) 2015年 廖马林. All rights reserved.
//

#import "UserModelArchive.h"

@implementation UserModelArchive

+ (UserModel *)unarchive {

    return [NSKeyedUnarchiver unarchiveObjectWithFile:[self archivePath]];  // 这个方法一调用，就会自动的调用nscoding的
}

+ (NSString *)archivePath {

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *basePath = paths.count > 0 ? [paths objectAtIndex:0] : nil;
    return [basePath stringByAppendingString:@"UserModel.dat"];
}

@end
